package com.ktjy.crm.service.impl;

import com.ktjy.crm.mapper.RoleMapper;
import com.ktjy.crm.model.Role;
import com.ktjy.crm.service.RoleService;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

@Service
public class RoleServiceImpl implements RoleService {
    @Resource // 自动注入
    RoleMapper roleMapper;
    @Override
    public int insert(Role record) {
        try{
            return roleMapper.insert(record);
        }catch (Exception e){
            e.printStackTrace();
        }
        return 0;
    }

    @Override
    public int delete(Long roleId) {
        try{
            return roleMapper.delete(roleId);
        }catch (Exception e){
            e.printStackTrace();
        }
        return 0;
    }

    @Override
    public int update(Role record) {
        try{
            return roleMapper.update(record);
        }catch (Exception e){
            e.printStackTrace();
        }
        return 0;
    }

    @Override
    public Role select() {
        try{
            return roleMapper.select();
        }catch (Exception e){
            e.printStackTrace();
        }
        return null;
    }
}
